Make wayland bits in meson.build conditional on wayland use
authorРуслан Ижбулатов <lrn1986@gmail.com>
Sat, 3 Mar 2018 21:55:15 +0000 (21:55 +0000)
committerChun-wei Fan <fanchunwei@src.gnome.org>
Wed, 28 Mar 2018 07:39:20 +0000 (15:39 +0800)
Otherwise the build won't configure due to its inability to find
wayland-scanner program on systems where no such program is availble.

https://bugzilla.gnome.org/show_bug.cgi?id=773299

gtk/meson.build

index a0b3932d572a0c0a2becd2f22d477ed05eb6a563..fa1f7b29086426a106455b70cec6714fd7df0a8f 100644 (file)
@@ -596,8 +596,10 @@ proto_sources = [
 ]
 
 im_wayland_sources = files('gtkimcontextwayland.c')
-wayland_scanner = find_program('wayland-scanner')
-genprotocols = find_program('../gdk/wayland/genprotocolfiles.py')
+if wayland_enabled
+  wayland_scanner = find_program('wayland-scanner')
+  genprotocols = find_program('../gdk/wayland/genprotocolfiles.py')
+endif
 
 foreach p: proto_sources
   proto_name = p.get(0)
@@ -612,25 +614,27 @@ foreach p: proto_sources
     input = join_paths(proto_dir, '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base))
   endif
 
-  im_wayland_sources += custom_target('@0@ client header'.format(output_base),
-                                      input: input,
-                                      output: '@0@-client-protocol.h'.format(output_base),
-                                      command: [
-                                        genprotocols,
-                                        wayland_scanner,
-                                        '@INPUT@', '@OUTPUT@',
-                                        'client-header',
-                                      ])
-
-  im_wayland_sources += custom_target('@0@ source'.format(output_base),
-                                      input: input,
-                                      output: '@0@-protocol.c'.format(output_base),
-                                      command: [
-                                        genprotocols,
-                                        wayland_scanner,
-                                        '@INPUT@', '@OUTPUT@',
-                                        'code',
-                                      ])
+  if wayland_enabled
+    im_wayland_sources += custom_target('@0@ client header'.format(output_base),
+                                        input: input,
+                                        output: '@0@-client-protocol.h'.format(output_base),
+                                        command: [
+                                          genprotocols,
+                                          wayland_scanner,
+                                          '@INPUT@', '@OUTPUT@',
+                                          'client-header',
+                                        ])
+
+    im_wayland_sources += custom_target('@0@ source'.format(output_base),
+                                        input: input,
+                                        output: '@0@-protocol.c'.format(output_base),
+                                        command: [
+                                          genprotocols,
+                                          wayland_scanner,
+                                          '@INPUT@', '@OUTPUT@',
+                                          'code',
+                                        ])
+  endif
 endforeach
 
 if os_unix